home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / obero / oberon_lib.lha / oberon-a / source1.lha / source / Amiga / Trackdisk.mod < prev    next >
Text File  |  1994-08-08  |  9KB  |  272 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: Trackdisk.mod $
  4.   Description: trackdisk device structure and value definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:44:39 $
  10.  
  11.   $VER: trackdisk.h 33.13 (28.11.90)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. MODULE Trackdisk;
  24.  
  25. (*
  26. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  27. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  28. ** $V- OvflChk       $Z- ZeroVars
  29. *)
  30.  
  31. IMPORT E := Exec;
  32.  
  33.  
  34. (*
  35.  *--------------------------------------------------------------------
  36.  *
  37.  * Physical drive constants
  38.  *
  39.  *--------------------------------------------------------------------
  40.  *)
  41.  
  42. CONST
  43.  
  44.   numSecs * = 11;
  45.   numUnits * = 4;
  46.  
  47. (*
  48.  *--------------------------------------------------------------------
  49.  *
  50.  * Useful constants
  51.  *
  52.  *--------------------------------------------------------------------
  53.  *)
  54.  
  55. CONST
  56.  
  57. (* -- sizes before mfm encoding *)
  58.   sector * = 512;
  59.   secShift * = 9;           (* log tdSECTOR *)
  60.  
  61. (*
  62.  *--------------------------------------------------------------------
  63.  *
  64.  * Driver Specific Commands
  65.  *
  66.  *--------------------------------------------------------------------
  67.  *)
  68.  
  69.  
  70. CONST
  71.  
  72.   name * = "trackdisk.device";
  73.  
  74.   extCom * = 08000H;              (* for internal use only! *)
  75.  
  76.  
  77.   motor *        = E.cmdNonstd+0;  (* control the disk's motor *)
  78.   seek *         = E.cmdNonstd+1;  (* explicit seek (for testing) *)
  79.   format *       = E.cmdNonstd+2;  (* format disk *)
  80.   remove *       = E.cmdNonstd+3;  (* notify when disk changes *)
  81.   changeNum *    = E.cmdNonstd+4;  (* number of disk changes *)
  82.   changeState *  = E.cmdNonstd+5;  (* is there a disk in the drive? *)
  83.   protStatus *   = E.cmdNonstd+6;  (* is the disk write protected? *)
  84.   rawRead *      = E.cmdNonstd+7;  (* read raw bits from the disk *)
  85.   rawWrite *     = E.cmdNonstd+8;  (* write raw bits to the disk *)
  86.   getDriveType * = E.cmdNonstd+9;  (* get the type of the disk drive *)
  87.   getNumTracks * = E.cmdNonstd+10; (* # of tracks for this type drive *)
  88.   addChangeInt * = E.cmdNonstd+11; (* tdREMOVE done right *)
  89.   remChangeInt * = E.cmdNonstd+12; (* remove softint set by ADDCHANGEINT *)
  90.   getGeometry *  = E.cmdNonstd+13; (* gets the disk geometry table *)
  91.   eject *        = E.cmdNonstd+14; (* for those drives that support it *)
  92.   lastComm *     = E.cmdNonstd+15;
  93.  
  94. (*
  95.  *
  96.  * The disk driver has an "extended command" facility.  These commands
  97.  * take a superset of the normal IO Request block.
  98.  *
  99.  *)
  100.  
  101. CONST
  102.  
  103.   extWrite *       = E.cmdWrite  + extCom;
  104.   extRead *        = E.cmdRead   + extCom;
  105.   extMotor *       = motor       + extCom;
  106.   extSeek *        = seek        + extCom;
  107.   extFormat *      = format      + extCom;
  108.   extUpdate *      = E.cmdUpdate + extCom;
  109.   extClear *       = E.cmdClear  + extCom;
  110.   extRawRead *     = rawRead     + extCom;
  111.   extRawWrite *    = rawWrite    + extCom;
  112.  
  113. (*
  114.  *
  115.  * extended IO has a larger than normal io request block.
  116.  *
  117.  *)
  118.  
  119. TYPE
  120.  
  121.   IOExtTDPtr * = CPOINTER TO IOExtTD;
  122.   IOExtTD * = RECORD (E.IOStdReq)
  123.     count *    : E.ULONG;
  124.     secLabel * : E.ULONG;
  125.   END; (* IOExtTD *)
  126.  
  127. (*
  128.  *  This is the structure returned by tdDRIVEGEOMETRY
  129.  *  Note that the layout can be defined three ways:
  130.  *
  131.  *  1. TotalSectors
  132.  *  2. Cylinders and CylSectors
  133.  *  3. Cylinders, Heads, and TrackSectors.
  134.  *
  135.  *  #1 is most accurate, #2 is less so, and #3 is least accurate.  All
  136.  *  are usable, though #2 and #3 may waste some portion of the available
  137.  *  space on some drives.
  138.  *)
  139.  
  140. TYPE
  141.  
  142.   DriveGeometryPtr * = CPOINTER TO DriveGeometry;
  143.   DriveGeometry * = RECORD
  144.     sectorSize *   : E.ULONG;  (* in bytes *)
  145.     totalSectors * : E.ULONG;  (* total # of sectors on drive *)
  146.     cylinders *    : E.ULONG;  (* number of cylinders *)
  147.     cylSectors *   : E.ULONG;  (* number of sectors/cylinder *)
  148.     heads *        : E.ULONG;  (* number of surfaces *)
  149.     trackSectors * : E.ULONG;  (* number of sectors/track *)
  150.     bufMemType *   : E.ULONG;  (* preferred buffer memory type *)
  151.                                (* (usually memfPUBLIC) *)
  152.     deviceType *   : E.UBYTE;  (* codes as defined in the SCSI-2 spec *)
  153.     flags *        : E.BSET;   (* flags, including removable *)
  154.     reserved *     : E.UWORD;
  155.   END; (* DriveGeometry *)
  156.  
  157. CONST
  158.  
  159. (* device types *)
  160.   dgDirectAccess *         = 0;
  161.   dgSequentialAccess *     = 1;
  162.   dgPrinter *              = 2;
  163.   dgProcessor *            = 3;
  164.   dgWorm *                 = 4;
  165.   dgCDRom *                = 5;
  166.   dgScanner *              = 6;
  167.   dgOpticalDisk *          = 7;
  168.   dgMediumChanger *        = 8;
  169.   dgCommunication *        = 9;
  170.   dgUnknown *              = 31;
  171.  
  172. (* flags *)
  173.   dgRemovable *           = 0;
  174.  
  175. (*
  176. ** raw read and write can be synced with the index pulse.  This flag
  177. ** in io request's ioFLAGS field tells the driver that you want this.
  178. *)
  179.  
  180.   ioIndexSync * = 4;
  181. (*
  182. ** raw read and write can be synced with a $4489 sync pattern.  This flag
  183. ** in io request's ioFLAGS field tells the driver that you want this.
  184. *)
  185.   ioWordSync *  = 5;
  186.  
  187.  
  188. (* labels are tdLabelSize bytes per sector *)
  189.  
  190.   labelSize * = 16;
  191.  
  192. (*
  193. ** This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  194. ** the driver will allow you to open all the disks that the trackdisk
  195. ** driver understands.  Otherwise only 3.5" disks will succeed.
  196. *)
  197.  
  198.   allowNon35 *       = 0;
  199.  
  200. (*
  201. **  If you set the tdbAllowNon35 bit in OpenDevice, then you don't
  202. **  know what type of disk you really got.  These defines are for the
  203. **  tdGETDRIVETYPE command.  In addition, you can find out how many
  204. **  tracks are supported via the tdGETNUMTRACKS command.
  205. *)
  206.  
  207.   drive35 *        = 1;
  208.   drive525 *       = 2;
  209.   drive35150RPM *  = 3;
  210.  
  211. (*
  212.  *--------------------------------------------------------------------
  213.  *
  214.  * Driver error defines
  215.  *
  216.  *--------------------------------------------------------------------
  217.  *)
  218.  
  219. CONST
  220.  
  221.   errNotSpecified *      = 20;      (* general catchall *)
  222.   errNoSecHdr *          = 21;      (* couldn't even find a sector *)
  223.   errBadSecPreamble *    = 22;      (* sector looked wrong *)
  224.   errBadSecID *          = 23;      (* ditto *)
  225.   errBadHdrSum *         = 24;      (* header had incorrect checksum *)
  226.   errBadSecSum *         = 25;      (* data had incorrect checksum *)
  227.   errTooFewSecs *        = 26;      (* couldn't find enough sectors *)
  228.   errBadSecHdr *         = 27;      (* another "sector looked wrong" *)
  229.   errWriteProt *         = 28;      (* can't write to a protected disk *)
  230.   errDiskChanged *       = 29;      (* no disk in the drive *)
  231.   errSeekError *         = 30;      (* couldn't find track 0 *)
  232.   errNoMem *             = 31;      (* ran out of memory *)
  233.   errBadUnitNum *        = 32;      (* asked for a unit > NUMUNITS *)
  234.   errBadDriveType *      = 33;      (* not a drive that trackdisk groks *)
  235.   errDriveInUse *        = 34;      (* someone else allocated the drive *)
  236.   errPostReset *         = 35;      (* user hit reset; awaiting doom *)
  237.  
  238. (*
  239.  *--------------------------------------------------------------------
  240.  *
  241.  * public portion of the unit structure
  242.  *
  243.  *--------------------------------------------------------------------
  244.  *)
  245.  
  246. TYPE
  247.  
  248.   PublicUnitPtr * = CPOINTER TO PublicUnit;
  249.   PublicUnit * = RECORD (E.Unit) (* base message port *)
  250.     comp01Track *    : E.UWORD;  (* track for first precomp *)
  251.     comp10Track *    : E.UWORD;  (* track for second precomp *)
  252.     comp11Track *    : E.UWORD;  (* track for third precomp *)
  253.     stepDelay *      : E.ULONG;  (* time to wait after stepping *)
  254.     settleDelay *    : E.ULONG;  (* time to wait after seeking *)
  255.     retryCnt *       : E.UBYTE;  (* # of times to retry *)
  256.     pubFlags *       : E.BSET;   (* public flags, see below *)
  257.     currTrk *        : E.UWORD;  (* track the heads are over... *)
  258.                                  (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  259.     calibrateDelay * : E.ULONG;  (* time to wait after stepping *)
  260.                                  (* during a recalibrate *)
  261.     counter *        : E.ULONG;  (* counter for disk changes... *)
  262.                                  (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  263.   END; (* PublicUnit *)
  264.  
  265. CONST
  266.  
  267. (* flags for tduPubFlags *)
  268.   pbNoClick *    = 0;
  269.  
  270.  
  271. END Trackdisk.
  272.